package com.sf.fy.uav.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.sf.fy.uav.common.request.operate.CouponRequest;
import com.sf.fy.uav.common.request.operate.QueryCouponRequest;
import com.sf.fy.uav.common.response.operational.CouponResponse;
import com.sf.fy.uav.common.response.operational.EffectiveCouponResponse;
import com.sf.fy.uav.common.response.operational.EffectiveCouponRsResponse;
import com.sf.fy.uav.entity.Coupon;
import com.sf.fy.uav.entity.UserCoupon;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author lixiang
 * @since 2023-09-12
 */
public interface CouponService extends IService<Coupon> {
    /**
     * 优惠券分页查询
     *
     * @param queryCouponRequest
     * @return
     */
    List<CouponResponse> queryCoupons(QueryCouponRequest queryCouponRequest);

    /**
     * 优惠券查总条数
     *
     * @param couponName
     * @param status
     * @return
     */
    Long getTotal(String couponName, Byte status);

    /**
     * 新增优惠券
     *
     * @param couponRequest
     */
    Coupon createCoupon(CouponRequest couponRequest);

    /**
     * 获取新人优惠券
     *
     * @return
     */
    Coupon getNewerCoupon();

    /**
     * 根据id查询优惠券
     *
     * @param id
     * @return
     */
    CouponResponse queryCouponById(String id);

    /**
     * @param id
     * @return
     */
    UserCoupon selectById(String id);

    /**
     * 获取有效优惠券
     *
     * @param page
     * @param size
     * @return
     */
    EffectiveCouponRsResponse getEffectiveCoupons(@RequestParam Integer page, @RequestParam Integer size);

    /**
     * 库存扣减
     *
     * @param couponId
     * @param updateTime
     * @param deductionAmount
     */
    Boolean deductionOfInventory(String couponId, Date updateTime, Integer deductionAmount);

    /**
     * 筛选正常的优惠券
     *
     * @param couponIds
     * @return
     */
    List<Coupon> getNormalByCouponIds(List<String> couponIds);
}
